-
Notifications
You must be signed in to change notification settings - Fork 712
[voq] VOQ cli show commands implementation #1689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This pull request introduces 3 alerts when merging 1dcbec93ed30d0030feb0ed35cee9055bbb74b2d into 5708497 - view on LGTM.com new alerts:
|
Hi @ysmanman - could you please review , thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as comments
tests/chassis_modules_test.py
Outdated
System Port Name Port Id Switch Id Core Core Port Speed | ||
---------------------------- --------- ----------- ------ ----------- ------- | ||
Linecard1|Asic0|Ethernet0 1 0 0 1 100G | ||
Linecard1|Asic0|Ethernet0 1 0 0 1 100G |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same output lines are repeated, is this because the same system-port information is present in every asic ?
This output is be confusing.
Can we either add
- a new column
asic_name
to indicate which asic this info is retrived or - make the
-n <asicname>
mandatory for the multi asic linecards , so that the we don't display same system port information multiple times
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The same information will be repeated multiple times - as many times as the number of asics. This is because we have identical system port config in all asics. We display this multiple times so that one can verify for the requirement of indentical system port configuration in all asics.
The option to make the mandatory seems better than displaying all entries with new column since there will be lots of entries if there are many asics.
I'll implement changes to make the asic name mandatory in the command. Thanks for the suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Namespace option is made "required" option.
scripts/voqutil
Outdated
""" | ||
Get CHASSIS_APP_DB SYSTEM_NEIGH table Keys | ||
""" | ||
system_neigh_keys = chassis_app_db.keys(chassis_app_db.CHASSIS_APP_DB, "SYSTEM_NEIGH|*") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use SYSTEM_NEIGH_TABLE_PREFIX
iso SYSTEM_NEIGH|
here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, here and in other places also.
scripts/voqutil
Outdated
self.db = None | ||
self.config_db = None | ||
self.table = [] | ||
self.multi_asic = multi_asic_util.MultiAsic( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks self.multi_asic
like this is not used ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Removed since this is not used
scripts/voqutil
Outdated
self.config_db = None | ||
self.system_lag_name = system_lag_name | ||
self.table = [] | ||
self.multi_asic = multi_asic_util.MultiAsic( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, looks self.multi_asic
like this is not used ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Removed since this is not used.
This pull request introduces 1 alert when merging d66725960b6f307a8c4a0d2bbb5a55dff69e1ae6 into e8b6c5c - view on LGTM.com new alerts:
|
scripts/voqutil
Outdated
|
||
# ========================== Common VOQ util logic ========================== | ||
|
||
SYSTEM_PORT_TABLE_PREFIX = "SYSTEM_PORT_TABLE:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the separator or table name defined in some python lib? If so, it would be great to import them, instead of hardcoding them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vganesan-nokia can you address @ysmanman's comment ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'll fix this if the table names are defined in some python lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed for table names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as comments
scripts/voqutil
Outdated
|
||
# ========================== Common VOQ util logic ========================== | ||
|
||
SYSTEM_PORT_TABLE_PREFIX = "SYSTEM_PORT_TABLE:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vganesan-nokia can you address @ysmanman's comment ?
if ipaddress is not None: | ||
cmd += " -a {}".format(ipaddress) | ||
|
||
if asicname is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vganesan-nokia this change will not work on the single asic linecards right ?
I think it will be better to the add the asicname check only on multi asic linecards ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that for system neighbors and system lags this is not namespace. It is the value of DEVICE_METADATA['localhost']['asic_name'] we filter on in keys . Therefore, this will/should work on single asic linecards also for the following reasons: (1) Even for the single asic line card, in voq chassis, it is mandatory to configure DEVICE_METADATA['localhost']['asic_name']. For single asic linecards, it may be always "asic0" or "Asic0". (2) Even if the command is executed from single asic linecard, we should be able to filter the entries (from chassis app db which has info for all asics from all linecards) for asic name of other line cards that have multiple asics.
------------------------------- -------- ----------- ------------------------------------------------------ | ||
Linecard2|Asic1|PortChannel0002 1 8 Linecard2|Asic1|Ethernet16, Linecard2|Asic1|Ethernet17 | ||
""" | ||
|
||
class TestChassisModules(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add tests for single asic line cards ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Please see my response to comment on chassis_modules.py:139-142
show/chassis_modules.py
Outdated
|
||
@chassis.command() | ||
@click.argument('systemlagname', required=False) | ||
@click.option('--asicname', '-x', 'asicname', default=None, type=str, show_default=False, help='Asic name') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use -n
here ? similar to show chassis system_ports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For system neighbors and system lags the info are retrieved from supervisor card's chassis app db which is not in any particular namespace. The 'asicname' here is not the namespace. It is the 'asic_name' we look for in the keys of the entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed "asicname" option selector to "-n" as suggested
show/chassis_modules.py
Outdated
|
||
@chassis.command() | ||
@click.argument('ipaddress', required=False) | ||
@click.option('--asicname', '-x', 'asicname', default=None, type=str, show_default=False, help='Asic name') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use -n
here ? similar to show chassis system_ports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my response to comments on line# 146-149
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed "asicname" option selector to "-n" as suggested
Implementation of the following show commands for VOQ chassis. - show chassis system-ports [<system port>] [-n <namespace>] [-d all] - show chassis system-neighbors - show chassis system-lags [<system lag>] The existing chassis commands under "show chassis_modules" and "config chassis_modules" have been renamed (moved) under "show chassis modules" and "config chassis modules" respectively Signed-off-by: vedganes <[email protected]>
Signed-off-by: vedganes <[email protected]>
Signed-off-by: vedganes <[email protected]>
Following changes done to address review comments - "-d" option is removed since this is not applicable - namespace option is made "required" for "show system-ports" command - "-x <asic name>" is used instead of namespace for "show system-neibhbors" and "show system-lags" since chassis db is namespace agnostic and also to take care of handling the case when the asic name many not match the namespace - "ipaddress" argument is introduced for "show system-neighbors" command to show info for specific neighbor. Signed-off-by: vedganes <[email protected]>
- LGTM warning fix. Removed unused import - Adjusted system port namespace option "not required" for single asic line cards. Signed-off-by: vedganes <[email protected]>
- Hard coded tables names are changed to use from swsscommon schema definition - Added option for linecard/host name filtering on system lag. Signed-off-by: vedganes <[email protected]>
- Changed asicname option from "-x" to "-n" - Changed hostname option to linecardname. Signed-off-by: vedganes <[email protected]>
1524777
to
1741bf5
Compare
/Azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Changes in this commit - Implementation of the following show commands for VOQ chassis. show chassis system-ports [<system port>] {-n <namespace>}, if multi-asic voq chassis show chassis system-ports [<system port>] , if single asic voq chassis show chassis system-neighbors [<nbr ip address>] [-n <asic name>] show chassis system-lags [<system lag>] [-n <asic name>] [-l <linecard or host name>] - The existing chassis commands under "show chassis_modules" and "config chassis_modules" have been renamed (moved) under "show chassis modules" and "config chassis modules" respectively Signed-off-by: vedganes <[email protected]>
What I did
Implementation of the following show commands for VOQ chassis.
The existing chassis commands under "show chassis_modules" and
"config chassis_modules" have been renamed (moved) under
"show chassis modules" and "config chassis modules" respectively
How I did it
Modified sonic utilities scripts
How to verify it
Previous command output (if the output of a command-line utility has changed)
Commands changes:
New command output (if the output of a command-line utility has changed)
No change in the output of the existing commands.